CMAKE_MINIMUM_REQUIRED(VERSION 3.17)

IF (NOT TARGET LIBYUV::H)
    ADD_LIBRARY(LIBYUV::H INTERFACE IMPORTED)
    TARGET_INCLUDE_DIRECTORIES(LIBYUV::H INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/windows/include")
ENDIF ()

IF (NOT TARGET LIBYUV::LIB)
    FIND_LIBRARY(LIBYUV_LIB NAMES yuv PATHS ${CMAKE_CURRENT_SOURCE_DIR}/windows/lib NO_DEFAULT_PATH)
    ADD_LIBRARY(LIBYUV::LIB STATIC IMPORTED)
    SET_TARGET_PROPERTIES(LIBYUV::LIB PROPERTIES IMPORTED_LOCATION "${LIBYUV_LIB}")
ENDIF ()

IF (NOT TARGET LIBRARIES::LIBYUV)
    ADD_LIBRARY(LIBRARIES::LIBYUV INTERFACE IMPORTED GLOBAL)
    TARGET_LINK_LIBRARIES(LIBRARIES::LIBYUV INTERFACE
            LIBYUV::H
            LIBYUV::LIB)
ENDIF ()